package top.ytazwc.take.application;

import top.ytazwc.take.redis.RedisUtils;

import java.util.concurrent.TimeUnit;

/**
 * @author 花木凋零成兰
 * @title CacheServiceImpl
 * @date 2024/4/28 14:39
 * @package top.ytazwc.take.application
 * @description 缓存服务实现类
 */
public class CacheServiceImpl implements CacheService {

    // 模拟依赖注入
    private RedisUtils redisUtils = new RedisUtils();

    @Override
    public String get(String key) {
        return redisUtils.get(key);
    }

    @Override
    public void set(String key, String value) {
        redisUtils.set(key, value);
    }

    @Override
    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
        redisUtils.set(key, value, timeout, timeUnit);
    }

    @Override
    public void del(String key) {
        redisUtils.del(key);
    }
}
